package com.itheima.manager;

import com.itheima.domain.SmsFlashPromotionSession;
import com.itheima.service.db.SmsFlashPromotionSessionService;
import com.itheima.util.R;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author ChenTianSui
 * @date 2022/11/12 10:34
 */
@Component
public class SmsFlashSessionManager {
    @DubboReference
    private SmsFlashPromotionSessionService sessionService;

    public R<List<SmsFlashPromotionSession>> findList() {
        List<SmsFlashPromotionSession> list = sessionService.findList();
        return R.success(list);
    }

    public R updateStatus(Integer id, Integer status) {
        sessionService.updateStatus(id, status);
        return R.success(1);
    }

    public R create(SmsFlashPromotionSession smsFlashPromotionSession) {
        return sessionService.create(smsFlashPromotionSession);

    }

    public R delete(Integer id) {
        return sessionService.delete(id);

    }

    public R update(SmsFlashPromotionSession smsFlashPromotionSession) {
        return R.success(sessionService.update(smsFlashPromotionSession));
    }


    public R<SmsFlashPromotionSession> findById(Integer id) {
        return R.success(sessionService.findById(id));

    }

    public R<List<Map<String, Object>>> selectList(Integer flashPromotionId) {
        return R.success(sessionService.selectList(flashPromotionId));

    }
}
 
